package state

func move(i Instruction, vm LuaVM) {
	a, b, _ := i.ABC()
	vm.Copy(b+1, a+1)
}

func jmp(i Instruction, vm LuaVM) {
	a, sbx := i.AsBx()
	vm.AddPC(sbx)
	if a != 0 {
		vm.CloseUpValues(a)
	}
}

func LoadNil(i Instruction, vm LuaVM) {
	a, b, _ := i.ABC()
	a += 1
	vm.PushNil()
	for i := a; i <= a+b; i++ {
		vm.Copy(-1, i)
	}
	vm.Pop(1)
}
func LoadBool(i Instruction, vm LuaVM) {
	a, b, c := i.ABC()
	a += 1
	vm.PushBoolean(b != 0)
	vm.Replace(a)
	if c != 0 {
		vm.AddPC(1)
	}
}
